import set from '@dfeidao/atom-web/local/set';
import set_node_cls from '@dfeidao/atom-web/ui/set-node-cls';
import { IFeidaoAiBrowserComponent } from '@dfeidao/web/interfaces';

export default async function a003(fd: IFeidaoAiBrowserComponent, args: { currentTarget: HTMLDivElement }) {
	const node = args.currentTarget.closest('[dlist]') as HTMLDivElement;
	const nodes = fd.data.node.querySelectorAll<HTMLDivElement>('[dlist]');
	nodes.forEach((i) => {
		set_node_cls(i, 'bg-c', false);
	});
	set_node_cls(node, 'bg-c', true);
	const pk_val = node.getAttribute('data-feidao-no');
	const search_field_val = node.getAttribute('data-feidao-name');
	set(fd, 'pk_val', pk_val);
	set(fd, 'search_field_val', search_field_val);
}
